home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / s_to_z / vpe_130 / pascal / minidemo.pas next >
Pascal/Delphi Source File  |  1996-09-15  |  4KB  |  115 lines

  1. {$A+,B-,D-,F-,G+,I-,K+,L-,N-,P-,Q-,R-,S-,T-,V-,W-,X+,Y-}
  2. {$M 8192,8192}
  3. program MiniDemo;
  4. uses
  5.   WinTypes,WinProcs,VPEngine,Strings;
  6.  
  7. var DemoText : array [0..1024] of char;
  8.  
  9. procedure SetDemoText;
  10. begin
  11. StrCat(StrCat(StrCat(StrCat(StrCat(StrCat(StrCat(StrCat(StrCat(StrCat(StrCat(StrCat(StrCat(StrCat(StrCopy(
  12. DemoText,'[PS 3 S 12 C Black J BO]The moment of impact bursts through the silence and in a roar of sound, the '),
  13. 'final second is prolonged in a world of echoes as if concrete and clay of '),
  14. 'Broadway itself was reliving its memories.'+#13+#10),
  15. 'The last great march past. Newsman stands limp as a whimper as audience and '),
  16. 'eventare locked as one. Bing Crosby coos''You don''t have to feel pain '),
  17. 'to sing the blues, you don''t have to holla - you don''t feel a thing in your '),
  18. 'dollar collar.'' Martin Luther cries ''Everybody Sing!'' and rings the grand old '),
  19. 'liberty bell. Leary, weary of his prison cell, walks on heaven, talks on hell.'+#13+#10),
  20. 'Who needs Medicare and the 35c flat rate fare, when Fred Astaire and '),
  21. 'Ginger Rogers are dancing through the air? From Broadway Melody stereotypes '),
  22. 'the band returns to ''Stars and Stripes'' bringing a tear to the moonshiner, '),
  23. 'who''s been pouring out his spirit from the illegal still. The pawn broker '),
  24. 'clears the noisy till and clutches his lucky dollar bill.'+#13+#10),
  25. 'Then the blackout.'+#13+#10+#13+#10),
  26. '(Genesis, ''The Lamb lies down on Broadway'')');
  27.  
  28. end;
  29. {// ========================================================================
  30. //                              MiniDemo
  31. // ========================================================================}
  32. procedure MiniDemoProc(Window : HWnd);
  33. var hdoc : LongInt;
  34. begin
  35.  
  36.    hdoc := VpeOpenDoc(Window, 'Mini Demo',-1, -1, 0);
  37.    VpeWriteBox(hdoc, 100, 100, 500, 200,
  38.                '[PS 0 B C LtRed]Hello');
  39.    VpeWriteBox(hdoc, 100, 250, 500, 350,
  40.                '[''Times New Roman'' S 30 C Blue]World!');
  41.    VpeWriteBox(hdoc, 100, 450, 1900, -1, DemoText);
  42.  
  43.    VpePreviewDoc(hdoc, nil, VPE_SHOW_NORMAL);
  44. end;
  45.  
  46.  
  47.  
  48.  
  49. {// ========================================================================
  50. //                              WndProc
  51. // ========================================================================}
  52. function WndProc(Window : HWnd;message : Word;wParam : Word;lParam : LongInt) : LongInt;export;
  53. begin
  54.    WndProc := 0;
  55.    case message of
  56.       WM_CREATE : MiniDemoProc(Window);
  57.      VPE_DESTROYWINDOW,
  58.      WM_DESTROY: PostQuitMessage(0);
  59.    else WndProc := DefWindowProc (Window, message, wParam, lParam) ;
  60.   end; {case }
  61. end;
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69. {// ========================================================================
  70. //                              WinMain
  71. //
  72. // Create a hidden Main Window
  73. // ========================================================================}
  74. const szAppName  = 'Mini Demo';
  75.  
  76. procedure WinMain;
  77. var Msg :TMsg ;
  78. var Window : HWnd;
  79. var wndclass  : TWndClass;
  80.  
  81. begin
  82.    if hPrevInst =0 then
  83.    begin
  84.       wndclass.style         := CS_HREDRAW or CS_VREDRAW ;
  85.       wndclass.lpfnWndProc   := @WndProc ;
  86.       wndclass.cbClsExtra    := 0 ;
  87.       wndclass.cbWndExtra    := 0 ;
  88.       wndclass.hInstance     := hInstance ;
  89.       wndclass.hIcon         := LoadIcon (hInstance, 'APP_ICON');
  90.       wndclass.hCursor       := LoadCursor (0, IDC_ARROW) ;
  91.       wndclass.hbrBackground := GetStockObject (WHITE_BRUSH) ;
  92.       wndclass.lpszMenuName  := szAppName ;
  93.       wndclass.lpszClassName := szAppName ;
  94.       RegisterClass (wndclass) ;
  95.    end;
  96.  
  97.    Window := CreateWindow (szAppName, szAppName,
  98.                         WS_OVERLAPPEDWINDOW,
  99.                         CW_USEDEFAULT, CW_USEDEFAULT,
  100.                         CW_USEDEFAULT, CW_USEDEFAULT,
  101.                         0, 0, hInstance, nil) ;
  102.  
  103.    while GetMessage (msg, 0, 0, 0) do
  104.    begin
  105.       TranslateMessage (msg) ;
  106.       DispatchMessage (msg) ;
  107.    end;
  108.  
  109.    Halt(msg.wParam);
  110. end;
  111.  
  112. begin
  113.   SetDemoText;
  114.   WinMain;
  115. end.